//
//  NetworkingAESConfigInterceptor.m
//  YiJuZhangShou
//
//  Created by 冷悦 on 16/3/8.
//  Copyright © 2016年 Uranus. All rights reserved.
//

#import "NetworkingAESConfigInterceptor.h"
#import "HeaderUtil.h"
#import "NetworkingAESManager.h"

@implementation NetworkingAESConfigInterceptor

- (BOOL)shouldCallAPIWithManager:(NetworkingBaseManager *)networkingManager{
    AFHTTPSessionManager *manager = networkingManager.manger;
    NSString *iv = ((NetworkingAESManager *)networkingManager).iv;
    
    if (manager != nil) {
        if (iv != nil) {
            [manager.requestSerializer setValue:iv forHTTPHeaderField:@"iv"];
            
            return YES;
        } else {
            DDLogError(@"Can Not Get iv, and iv Is nil");
        }
    } else {
        DDLogError(@"Can Not Get AFHTTPSessionManager");
    }
    
    return NO;
}

@end
